package com.guigu.dispatch.controller;


import com.guigu.dispatch.entity.CacheLineUse;
import com.guigu.dispatch.entity.OrderClassify;
import com.guigu.dispatch.service.OrderClassifyService;
import com.guigu.tms.result.R;
import com.guigu.tms.result.ResultCode;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 订单分类记录 前端控制器
 * </p>
 *
 * @author TaoLong
 * @since 2021-11-18
 */
@RestController
@RequestMapping("/dispatch/order-classify")
public class OrderClassifyController {

    private OrderClassifyService orderClassifyService;

    public OrderClassifyController(OrderClassifyService orderClassifyService) {
        this.orderClassifyService = orderClassifyService;
    }


    /**
     * 根据订单分类Id查询订单分类数据
     *
     * @param orderClassifyId 订单分类Id
     * @return
     */
    @ApiOperation("根据订单分类Id查询订单分类数据")
    @GetMapping("/geOrderClassifyById/{orderClassifyId}")
    public R<OrderClassify> geOrderClassifyById(@PathVariable("orderClassifyId") String orderClassifyId) {
        OrderClassify classify = orderClassifyService.getById(orderClassifyId);
        if (ObjectUtils.isEmpty(classify)) {
            return new R<>(ResultCode.ERROR_CODE, null);
        }
        return new R<>(ResultCode.SUCCESS_CODE, classify);
    }
}

